<?php

use Illuminate\Database\Seeder;
use App\Models\AdminPermission as Permission;

class AdminPermissionsTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $permissions = [
            [
                'pid' => 0,
                'title' => '管理员信息管理',
                'name' => 'admin.admin',
                'icon' => 'glyphicon glyphicon-lock',
                'type' => 1
            ],
            [
                'pid' => 1,
                'title' => '权限管理',
                'name' => 'admin.admin-permissions.index',
                'type' => 1
            ],
            [
                'pid' => 1,
                'title' => '角色管理',
                'name' => 'admin.admin-roles.index',
                'type' => 1
            ],
            [
                'pid' => 1,
                'title' => '管理员管理',
                'name' => 'admin.admin-users.index',
                'type' => 1
            ],
            [
                'pid' => 0,
                'title' => '用户信息管理',
                'name' => 'admin.user',
                'icon' => 'glyphicon glyphicon-user',
                'type' => 1
            ],
            [
                'pid' => 5,
                'title' => '权限管理',
                'name' => 'admin.permissions.index',
                'type' => 1
            ],
            [
                'pid' => 5,
                'title' => '角色管理',
                'name' => 'admin.roles.index',
                'type' => 1
            ],
            [
                'pid' => 5,
                'title' => '用户管理',
                'name' => 'admin.users.index',
                'type' => 1
            ],
            [
                'pid' => 2,
                'title' => '创建权限',
                'name' => 'admin.admin-permissions.create',
                'type' => 0
            ],
            [
                'pid' => 2,
                'title' => '编辑权限',
                'name' => 'admin.admin-permissions.update',
                'type' => 0
            ],
            [
                'pid' => 2,
                'title' => '删除权限',
                'name' => 'admin.admin-permissions.delete',
                'type' => 0
            ],
            [
                'pid' => 3,
                'title' => '创建角色',
                'name' => 'admin.admin-roles.create',
                'type' => 0
            ],
            [
                'pid' => 3,
                'title' => '编辑角色',
                'name' => 'admin.admin-roles.update',
                'type' => 0
            ],
            [
                'pid' => 3,
                'title' => '分配权限',
                'name' => 'admin.admin-roles.give_permission',
                'type' => 0
            ],
            [
                'pid' => 3,
                'title' => '删除角色',
                'name' => 'admin.admin-roles.delete',
                'type' => 0
            ],
            [
                'pid' => 4,
                'title' => '创建管理员',
                'name' => 'admin.admin-users.create',
                'type' => 0
            ],
            [
                'pid' => 4,
                'title' => '编辑管理员',
                'name' => 'admin.admin-users.update',
                'type' => 0
            ],
            [
                'pid' => 4,
                'title' => '分配角色',
                'name' => 'admin.admin-users.give_role',
                'type' => 0
            ],
            [
                'pid' => 4,
                'title' => '分配权限',
                'name' => 'admin.admin-users.give_permission',
                'type' => 0
            ],
            [
                'pid' => 4,
                'title' => '删除管理员',
                'name' => 'admin.admin-users.delete',
                'type' => 0
            ],
            [
                'pid' => 6,
                'title' => '创建权限',
                'name' => 'admin.permissions.create',
                'type' => 0
            ],
            [
                'pid' => 6,
                'title' => '编辑权限',
                'name' => 'admin.permissions.update',
                'type' => 0
            ],
            [
                'pid' => 6,
                'title' => '删除权限',
                'name' => 'admin.permissions.delete',
                'type' => 0
            ],
            [
                'pid' => 7,
                'title' => '创建角色',
                'name' => 'admin.roles.create',
                'type' => 0
            ],
            [
                'pid' => 7,
                'title' => '编辑角色',
                'name' => 'admin.roles.update',
                'type' => 0
            ],
            [
                'pid' => 7,
                'title' => '分配权限',
                'name' => 'admin.roles.give_permission',
                'type' => 0
            ],
            [
                'pid' => 7,
                'title' => '删除角色',
                'name' => 'admin.roles.delete',
                'type' => 0
            ],
            [
                'pid' => 8,
                'title' => '创建用户',
                'name' => 'admin.users.create',
                'type' => 0
            ],
            [
                'pid' => 8,
                'title' => '编辑用户',
                'name' => 'admin.users.update',
                'type' => 0
            ],
            [
                'pid' => 8,
                'title' => '分配角色',
                'name' => 'admin.users.give_role',
                'type' => 0
            ],
            [
                'pid' => 8,
                'title' => '分配权限',
                'name' => 'admin.users.give_permission',
                'type' => 0
            ],
            [
                'pid' => 8,
                'title' => '删除用户',
                'name' => 'admin.users.delete',
                'type' => 0
            ],
        ];

        foreach ($permissions as $permission){
            Permission::create($permission);
        }
    }
}
